/**
 * Copyright (c) 2012-2013 Nokia Corporation. All rights reserved.
 * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. 
 * Oracle and Java are trademarks or registered trademarks of Oracle and/or its
 * affiliates. Other product and company names mentioned herein may be trademarks
 * or trade names of their respective owners. 
 * See LICENSE.TXT for license information.
 */
package com.nokia.example.fuelcalculator.view;

import com.nokia.example.fuelcalculator.l10n.L10NIDs;
import com.nokia.example.fuelcalculator.l10n.Localizer;
import com.nokia.example.fuelcalculator.utils.Commands;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Item;
import javax.microedition.lcdui.StringItem;

/**
 * This is the View that is shown when "Help" command is selected.
 */
public final class HelpView
    implements View {

    private Form form;
    private Localizer localizer;
    private StringItem text;

    /**
     * Constructor.
     * @param viewManager 
     */
    public HelpView(ViewManager viewManager) {
        this.localizer = Localizer.getInstance();
        this.form = new Form(localizer.getString(L10NIDs.HELP_VIEW_TITLE));
        layoutForm();
        form.addCommand(Commands.BACK_FROM_ABOUT_OR_HELP);
        form.setCommandListener(viewManager);
    }

    /**
     * @see fuelconsumption.view.View#updateUI()
     */
    public void updateUI() {
        // nothing to do in a static view
    }

    /**
     * @see fuelconsumption.view.View#updateUI()
     */
    public Displayable getDisplayable() {
        return form;
    }
    
    private void layoutForm() {
        text = new StringItem(
                null,
                Localizer.getInstance().getString(L10NIDs.HELP_VIEW_TEXT));
        form.append(text);
    }
}
